package marina;

import java.util.Scanner;

public class J15Ch05Calculator_ {
	public static void main(String[] args) {
		String msg = "두 정수와 연산자를 입력하세요.";
		Scanner sc = new Scanner(System.in);
		// new 연산자를 이용한 객체 생성은 최대한 천천히 실행할 것!
		J15Add add = null;
		J15Sub sub = null;
		J15Mul mul = null;
		J15Div div = null;

		System.out.println(msg);
		int a = sc.nextInt();
		int b = sc.nextInt();
		String c = sc.next();

		switch (c) {
		case "+":
			add = new J15Add();
			add.setValue(a, b);
			System.out.println(add.calculate());
			break;
		case "-":
			sub = new J15Sub();
			sub.setValue(a, b);
			System.out.println(add.calculate());
			break;
		case "*":
			mul = new J15Mul();
			sub.setValue(a, b);
			System.out.println(add.calculate());
			break;
		case "/":
			div = new J15Div();
			div.setValue(a, b);
			if (a % b == 0) {
				System.out.println(add.calculate());
			} else {
				System.out.println(add.calculated());
			}
			break;
		}

		sc.close();
	}
}
